﻿using System.Collections.Generic;
using System.IO;
using System.Web.Http;

namespace Serve.Controllers
{
    public class ServeJSONController : ApiController
    {
        // GET api/servejson
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }

        // GET api/servejson/5
        public string Get(string id)
        {
            switch (id.ToLower())
            {
                case "52ce79c4-5e4b-43a1-b01a-55565e2a9602":
                    return File.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory + "/1.txt").ToString();
                case "b013717a-cdce-4a92-8411-b2d1dcb0250e":
                    return File.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory + "/2.txt").ToString();
                case "e2979839-4499-4bf6-b8e7-f8f1dd3ecb42":
                    return File.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory + "/3.txt").ToString();
                case "ca977fb4-cf69-4ab2-8d29-ead67f94961e":
                    return File.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory + "/4.txt").ToString();
                default:
                    return "{\"message\":\"country not found\"}";
            }
        }

        // POST api/servejson
        public void Post([FromBody]string value)
        {
        }

        // PUT api/servejson/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/servejson/5
        public void Delete(int id)
        {
        }
    }
}
